package com.muyu.user.domain.resp;

import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import com.muyu.user.domain.SysUserPoints;
import com.muyu.user.domain.model.SysUserPointsPageQueryModel;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.experimental.SuperBuilder;

/**
 * 积分明细分页接口返回结果集
 *
 * @author liuguoqiang
 * @date 2025-09-18
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "积分明细分页接口返回结果集")
public class SysUserPointsPageResp {

    /**
     * 来源/用途
     */
    @Schema(name = "source", title = "来源/用途", description = "来源/用途" )
    private String source;

    /**
     * 积分变化
     */
    @Schema(name = "pointsChange", title = "积分变化", description = "积分变化" )
    private Long pointsChange;

    /**
     * 变化后积分
     */
    @Schema(name = "pointsAfter", title = "变化后积分", description = "变化后积分" )
    private Long pointsAfter;

    /**
     * 备注
     */
    @Schema(name = "remark", title = "备注", description = "备注" )
    private String remark;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date createTime;

    /**
     * 信息构造器
     */
    public static SysUserPointsPageResp infoBuild(SysUserPointsPageQueryModel pageQueryModel){
        return SysUserPointsPageResp.builder()
            .source(pageQueryModel.getSource())
            .pointsChange(pageQueryModel.getPointsChange())
            .pointsAfter(pageQueryModel.getPointsAfter())
            .remark(pageQueryModel.getRemark())
                .createTime(pageQueryModel.getCreateTime())
            .build();
    }

}
